<template>
  <div id="app">
    <v-header :seller="seller" ></v-header>
    <div class="nav">
      <div class="nav-item active"><router-link to="/goods">商品</router-link></div>
      <div class="nav-item"><router-link to="/ratings">评论</router-link></div>
      <div class="nav-item"><router-link to="/seller">商家</router-link></div>
    </div>
    <router-view :seller="seller"></router-view>
  </div>
</template>

<script>
import header from './components/header/header.vue';
const ERR_OK = 0;
export default {
  name: 'app',
  components: {
    'v-header': header
  },
  data() {
    return {
      seller: {}
    };
  },
  created() {
    this.$http.get('/api/seller').then((response) => {
      var data = response.body;
      console.log(response.body);
      if (data.errno === ERR_OK) {
        this.seller = data.data;
      }
    });
  }
};
</script>

<style lang="less"  rel="stylesheet/less" type="text/less">
  .nav {
    display: flex;
    width: 100%;
    height: 40px;
    line-height: 40px;
    .nav-item {
      flex: 1;
      text-align: center;
      & > a {
        display: block;
        font-size: 14px;
        color: rgb(77, 85, 93);
        &.active{
          color: rgb(240, 20, 20);
        }
      }
    }
  }
</style>
